package com.fang.api_encryption.controller;

import com.fang.api_encryption.common.ResponseEntity;
import com.fang.api_encryption.entrty.User;
import com.fang.api_encryption.entrty.UserType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description
 * @Author Bernie
 * @Date 2023/11/17 14:33
 **/
@RestController
@RequestMapping("/secret/user")
public class UserEncryptController {


    @RequestMapping("/list")
    public ResponseEntity listUser() throws Exception {
        List<User> users = new ArrayList<>();
        User u = new User();
        u.setId(1);
        u.setName("boyka");
        u.setRegisterTime(LocalDateTime.now());
        u.setUserType(UserType.COMMON);
        users.add(u);

//        String encryptMsg = rsaUtil.encryptByPublicKey(users.toString());
//        String encryptMsg = rsaUtil.encryptByPrivateKey(users.toString());
        ResponseEntity response = new ResponseEntity();
        response.setCode(200);
//        response.setData(encryptMsg);
        response.setMsg("用户列表查询成功");
        return response;
    }

}
